package com.example.ddz.framework;

/**
 * Created by IntelliJ IDEA.
 * User: Marcel Melzig
 * Date: 09.08.11
 * Time: 19:26
 */

import android.graphics.Bitmap;

import com.example.ddz.framework.IGraphics.PixmapFormat;

/**
 * This class stores the graphical data for the screen.
 */
public class AndroidPixmap implements IPixmap
{
    final Bitmap bitmap;
    private final PixmapFormat format;

    /**
     * Creates an instance of the AndroidPixmap class.
     *
     * @param bitmap The bitmap.
     * @param format The format.
     */
    public AndroidPixmap(Bitmap bitmap, PixmapFormat format)
    {
        this.bitmap = bitmap;
        this.format = format;
    }

    /**
     * Gets the width of the bitmap.
     *
     * @return The width of the bitmap.
     */
    @Override
    public int GetWidth()
    {
        return bitmap.getWidth();
    }

    /**
     * Gets the height of the bitmap.
     *
     * @return The height of the bitmap.
     */
    @Override
    public int GetHeight()
    {
        return bitmap.getHeight();
    }

    /**
     * Gets the format of the bitmap.
     *
     * @return The format of the bitmap.
     */
    @Override
    public PixmapFormat GetFormat()
    {
        return format;
    }

    /**
     * Disposes the Bitmap.
     */
    @Override
    public void Dispose()
    {
        bitmap.recycle();
    }
}

